import java.util.Random;
import java.util.Scanner;

public class Test {

    public static int fun1(int k){
       int j=0;
        for (int i = 1; i <= k; i++) {
           j+=fun2(i);
        }
        return j;
    }
    public static int fun2(int a){
        int j=1;
        for (int i = 1; i <= a; i++) {
            j*=i;
        }
        return j;
    }
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("阶乘的所有和");
        int k= scanner.nextInt();

        int ret= fun1(k);
        System.out.println(ret);
    }
    public static int add(int a){
        if((a%100==0)&&(a%400==0)||(a%4==0)){
            System.out.println("为闰年"+a);
            return a;
        }else{
            System.out.println("不是闰年");
            return 0;
        }


    }
    public static void main6(String[] args) {

        Scanner scanner =new Scanner(System.in);


        int ret;
        System.out.println("请判断是否为闰年");
        int a=scanner.nextInt();

         ret=add(a);
         if (ret==0){
             System.out.println("判断错误");
         }else{
             System.out.println("猜对了");
         }

    }
    public static void main4(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Random random =new Random();
        int randNum =random.nextInt(101);//生成1到100的数字

        while(true){
            System.out.println("请输入你的答案");
            int num1 =scanner.nextInt();
            if (num1==randNum){
                System.out.println("猜对了");
                break;
            }else if (num1<randNum){
                System.out.println("猜小了");
            }else{
                System.out.println("猜大了");
            }

        }
    }





    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你的名字");
        String str =scanner.nextLine();
        System.out.println(str);
        System.out.println("请输入你的电话");
        String str1=scanner.nextLine();
        System.out.println(str1);

    }
    public static void main1(String[] args) {
        int sum=0;
        for (int j=1;j<=2;j++){

            int ret=1;
            for (int i=1; i<=j;i++){
                ret*=i;


            }
            sum+=ret;

        }
        System.out.println(sum);


    }
}
